<?php
require_once ("../dbconnect.php");

$title = $_GET["title"];

$db = dbconnect();

$sql = "SELECT count(*) FROM characters WHERE title=$title";
$rowct = $db->getOne($sql);

if ( $rowct > 0 ) {

	$sql = "SELECT name FROM characters WHERE title=$title";
	$result = $db->query($sql);
	
	if ( $result ) {
		
		$i = 0;
		while ( $row = $result->fetchRow() ) {
			echo $row[0];
			if ( $i < $rowct-1 ) {
				echo ",";
			}
			$i++;
		}
	}
}

$db->disconnect();
?>